﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace WpfApp6.Validations
{
    public class NameValidationRule : ValidationRule
    {
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            var length = value.ToString().Length;
            if (length > 2 && length <= 10)
            {
                return new ValidationResult(true, errorContent:"");
            }
            return new ValidationResult(false, errorContent:"长度在2-10之间");
        }
    }
}
